package org.example.v3;

import org.example.v3.action.*;

/**
 * OrderStateFactory 类用于创建订单状态实例。
 */
public class OrderStateFactory {
    public static StateAction<OrderStateMachine, String> getState(String stateName) {
        switch (stateName) {
            case "pending":
                return new PendingStateAction();
            case "paid":
                return new PaidStateAction();
            case "shipped":
                return new ShippedStateAction();
            case "delivered":
                return new DeliveredStateAction();
            default:
                throw new IllegalArgumentException("未知的状态: " + stateName);
        }
    }
}
